class NFO(object):
    
    def __init__(self, episode, dir):
        xml ="<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n"
        xml+="<episodedetails>\n"
        xml+="    <fileinfo>\n"
        xml+="        <streamdetails>\n"
        xml+="            <video>\n"
        xml+="                <container>."+episode.container+"</container>\n"
        xml+="            </video>\n"
        xml+="        </streamdetails>\n"
        xml+="    </fileinfo>\n"
        xml+="    <title>"+episode.title.encode('utf-8')+"</title>\n"
        xml+="    <season>"+episode.season+"</season>\n"
        xml+="    <episode>"+episode.completeNumber+"</episode>\n"
        xml+="    <aired>"+episode.aired+"</aired>\n"
        xml+="    <plot>"+episode.plot.encode('utf-8')+"</plot>\n"
        xml+="    <director>"+episode.director+"</director>\n"
        xml+="    <rating>"+episode.rating+"</rating>\n"
        xml+="</episodedetails>\n"
        
        self.name = "%s\\%s.nfo" % (dir, episode.getFileName())
        self.data = xml
    
    def save(self):
        file = open(self.name,"w")
        file.writelines(self.data)
        file.close()
     
    def __str__(self):
        return self.name
        